package com.webchat.rmi.ugc.mall;

import com.webchat.common.bean.APIPageResponseBean;
import com.webchat.common.bean.APIResponseBean;
import com.webchat.domain.vo.request.mall.MallUserCartRequestVO;
import com.webchat.domain.vo.response.mall.MallUserCartListResponseVO;
import com.webchat.rmi.interceptor.RpcRequestInterceptor;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

@FeignClient(name = "webchat-ugc-service",
        contextId = "mallUserCartClient",
        configuration = RpcRequestInterceptor.class)
public interface MallUserCartClient {


    /**
     * 加入购物车
     *
     * @param userCartRequest
     * @return
     */
    @PostMapping("/ugc-service/cart/add")
    APIResponseBean<Boolean> addCart(@RequestBody MallUserCartRequestVO userCartRequest);

    /**
     * 删除购物车
     *
     * @return
     */
    @PostMapping("/ugc-service/cart/remove")
    APIResponseBean<Boolean> deleteCart(@RequestBody MallUserCartRequestVO userCartRequest);

    /**
     * 购物车列表
     *
     * @return
     */
    @GetMapping("/ugc-service/cart/page")
    APIPageResponseBean<MallUserCartListResponseVO> page(
            @RequestParam(value = "userId") String userId,
            @RequestParam(value = "pageNo", required = false, defaultValue = "1") Integer pageNo,
            @RequestParam(value = "pageSize", required = false, defaultValue = "10") Integer pageSize);
    /**
     * 购物车sku数量修改
     *
     * @return
     */
    @PostMapping("/ugc-service/cart/updateCount")
    APIResponseBean<Boolean> updateCount(@RequestBody MallUserCartRequestVO userCartRequest);

}
